import type { Component } from "vue";
import type { ComponentType } from "./componentType";
import { ElInput, ElSelect, ElRadio, ElRadioGroup, ElCheckbox, ElCheckboxGroup, ElCascader, ElDatePicker, ElInputNumber, ElSwitch, ElTimePicker, ElTreeSelect, ElRate, ElButton, ElEmpty, ElAutocomplete, ElOptionGroup, ElOption } from "element-plus";
import MonacoEditor from "./components/MonacoEditor";

const componentMap = new Map<ComponentType, Component>();

componentMap.set("ElButton", ElButton);
componentMap.set("ElInput", ElInput);
componentMap.set("ElInputSearch", ElInput.Search);
componentMap.set("ElInputNumber", ElInputNumber);
componentMap.set("ElSelect", ElSelect);
componentMap.set("ElOptionGroup", ElOptionGroup);
componentMap.set("ElTreeSelect", ElTreeSelect);
componentMap.set("ElSwitch", ElSwitch);

componentMap.set("ElRadioGroup", ElRadioGroup);
componentMap.set("ElRadio", ElRadio);
componentMap.set("ElCheckboxGroup", ElCheckboxGroup);
componentMap.set("ElCheckbox", ElCheckbox);

componentMap.set("ElCascader", ElCascader);
componentMap.set("ElRate", ElRate);
componentMap.set("ElDatePicker", ElDatePicker);
componentMap.set("ElTimePicker", ElTimePicker);
componentMap.set("ElEmpty", ElEmpty);
componentMap.set("ElAutodcomplete", ElAutocomplete);
componentMap.set("ElOption", ElOption);

componentMap.set("MonacoEditor", MonacoEditor);

export function add(compName: ComponentType, component: Component) {
    componentMap.set(compName, component);
}

export function del(compName: ComponentType) {
    componentMap.delete(compName);
}

export { componentMap };
